//
//  UIView+Extesion.swift
//  weibo
//
//  Created by 上官风雨 on 15/11/16.
//  Copyright © 2015年 上官风雨. All rights reserved.
//

import UIKit

extension UIView {
    //通过响应者链条找到导航控制器
    func navController() -> UINavigationController?{
        
        var next = self.nextResponder()
        //遍历响应者链条
        repeat{
            
        if next is UINavigationController{
            
            return next as? UINavigationController
            
            }
            
            next = next?.nextResponder()
        
        }while(next != nil)
        
        return nil
    }
    
    

}
